package org.krivtsun.scanlab.batch;

import javax.imageio.ImageIO;
import javax.media.jai.JAI;

import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.awt.*;

/**
 * @author Andrew Krivtsun
 */
class PageEntry {
    private final File file;
    private Image thumbnail;

    PageEntry(File file) {
        this.file = file;
    }

    File getFile() {
        return file;
    }

    RenderedImage getImage() {
//        try {
            System.out.println("!!! Load image = "+file.getName());
            return JAI.create("fileload", file.getAbsolutePath());
//        } catch (IOException e) {
//            e.printStackTrace();
//            return null;
//        }
    }

    Image getThumbnail() {
        return thumbnail;
    }

    void setThumbnail(Image thumbnail) {
        this.thumbnail = thumbnail;
    }
}
